package com.tvsinfo.jdk.demo.case2_function_interface;

import lombok.Data;

import java.util.Arrays;
import java.util.List;

public class FunctionDemo2 {


    public static void main(String[] args) {
        OldOrderInfo oldOrderInfo = new OldOrderInfo();
        oldOrderInfo.setONo("90112378945314733511280");
        oldOrderInfo.setOName("外卖小单");

        List<OldOrderInfo> list = Arrays.asList(oldOrderInfo);
        list.stream().map(FunctionDemo2::oldTONewOrderInfo);
        NewOrderInfo newOrderInfo = oldTONewOrderInfo(oldOrderInfo);

    }

    public static NewOrderInfo oldTONewOrderInfo(OldOrderInfo oldOrderInfo) {
        NewOrderInfo newOrderInfo = new NewOrderInfo();
        newOrderInfo.setOrderNo(oldOrderInfo.getONo());
        newOrderInfo.setOrderName(oldOrderInfo.getOName());
        return newOrderInfo;
    }


    @Data
    public static class OldOrderInfo {
        private String oNo;
        private String oName;

    }

    @Data
    public static class NewOrderInfo {
        private String orderNo;
        private String orderName;

    }
}
